package org.cybergarage.http;

import java.net.ServerSocket;
import java.net.Socket;

import org.cybergarage.util.Debug;

public class SecureHTTPServer extends HTTPServer {
	
	public void run()
	{
		Thread httpServerThread = getHTTPServerThread();
		if (isOpened() == false)
			return;
			
		Thread thisThread = Thread.currentThread();
		
		while (httpServerThread == thisThread) {
			Thread.yield();
			Socket sock;
			try {
				sock = accept();
				Debug.message("accept ...(secured)");
				if (sock != null)
					Debug.message("sock = " + sock.getRemoteSocketAddress());
			}
			catch (Exception e){
				Debug.warning(e);
				break;
			}
			SecureHTTPServerThread httpServThread = new SecureHTTPServerThread(this, sock);
			httpServThread.start(); 
			Debug.message("httpServThread ...");
		}
	}

}
